package com.lkwlw.tplms.model;

import java.util.List;

public class Pager {
	
	private int pageSize = 20;//每页显示记录数 
	
	private List<?> items;
	
	private int totalCount; //总记录数     

	private int totalPage;//总页数 
	
	private int currentPage;//当前页

	private String paginationModel;
	
	public String getPaginationModel() {
		return paginationModel;
	}

	public void setPaginationModel(String paginationModel) {
		this.paginationModel = paginationModel;
	}
	
	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public List<?> getItems() {
		return items;
	}

	public void setItems(List<?> items) {
		this.items = items;
	}

	public int getTotalCount() {
		return totalCount;
	}


    public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	
	
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public int getTotalPage() {
		
		if (totalCount % this.pageSize == 0) {
			this.totalPage = totalCount / this.pageSize;
		} else {
			this.totalPage = totalCount / this.pageSize + 1;
		}
		return this.totalPage;
	}

	public int getStart(){
		if (currentPage>getTotalPage()) {
			currentPage=1;
		}
		return (currentPage-1)*pageSize;
		
	}
}
